#include <bits/stdc++.h>
using namespace std;

#define ll long long

const ll N = 2e6 + 5;
ll f[N], n, g[N], m;
bool ck(ll x){
    if(x < N)return !f[x];
    for(ll i = 1; i <= m && g[i] <= sqrt(x); ++i)
        if(x%g[i] == 0)return 0;
    return 1;
}
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if (fopen("sodep.inp", "r"))
    {
        freopen("sodep.inp", "r", stdin);
        freopen("sodep.out", "w", stdout);
    }

    f[0] = f[1] = 1;
    for(ll i = 2; i < N; ++i)if(!f[i]){
        g[++m] = i;
        for(ll j = i*i; j < N; j += i)
            f[j] = 1;
    }

        ll res = 0;
        cin >> n;
        for(ll i=1;i<=n;i++){
            ll x; cin >> x;
            if(x <= 1)continue;
            if(ck(x)){
                ll c1 = 0, c2 = 0;
                while(x){
                    if(x&1)c1++;
                    else c2++;
                    x /= 10;
                }
                if(c1 != c2)res++;
            }
        }
        cout << res;

}
